﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Reflection;
using System.Web.Configuration;
using System.Xml;
using System.Diagnostics;

namespace FSY.Globals
{
    public class Fsy_Config
    {
        public static string GetConnectionString()
        {
            return GetConnectionString("SqlConnectionString");
        }
        public static string GetConnectionString(string name)
        {
            string connectionString = "";
            if (!string.IsNullOrEmpty(name))
                connectionString = WebConfigurationManager.AppSettings.Get(name).ToString();
            if (connectionString == "")
                connectionString = WebConfigurationManager.ConnectionStrings[name].ConnectionString;
            return connectionString;
        }
        public static object GetSection(string sectionName)
        {
            return WebConfigurationManager.GetSection(sectionName);
        }
        public static string GetAppSetting(string appSetting)
        {
            return WebConfigurationManager.AppSettings.Get(appSetting);
        }
        public static int SlidingExpiration()
        {
            if (!string.IsNullOrEmpty(GetAppSetting("TimeOutCache")))
                return int.Parse(GetAppSetting("TimeOutCache"));
            else
                return 60;
        }
    }
}
